<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
use Hyperf\ConfigApollo\PullMode;
use Hyperf\ConfigCenter\Mode;

return [
    'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
    'driver' => env('CONFIG_CENTER_DRIVER', 'nacos'),
    'mode' => env('CONFIG_CENTER_MODE', Mode::PROCESS),
    'drivers' => [
        //        'apollo' => [
        //            'driver' => Hyperf\ConfigApollo\ApolloDriver::class,
        //            'pull_mode' => PullMode::INTERVAL,
        //            'server' => 'http://127.0.0.1:9080',
        //            'appid' => 'test',
        //            'cluster' => 'default',
        //            'namespaces' => [
        //                'application',
        //            ],
        //            'interval' => 5,
        //            'strict_mode' => false,
        //            'client_ip' => \Hyperf\Utils\Network::ip(),
        //            'pullTimeout' => 10,
        //            'interval_timeout' => 1,
        //        ],
        'nacos' => [
            'driver' => Hyperf\ConfigNacos\NacosDriver::class,
            // 配置合并方式，支持覆盖和合并
            'merge_mode' => Hyperf\ConfigNacos\Constants::CONFIG_MERGE_OVERWRITE,
            'interval' => 3,
            // 如果对应的映射 key 没有设置，则使用默认的 key
            'default_key' => 'nacos_config',
            'listener_config' => [
                // dataId, group, tenant, type, content
                // 映射后的配置 KEY => Nacos 中实际的配置
//                 'nacos_config' => [
//                     'tenant' => env('nacos_namespace_id'), // corresponding with service.namespaceId
//                     'data_id' => env('nacos_config_data_id'),
//                     'group' => env('nacos_config_default_group'),
//                     'type' => env('nacos_config_type','json'),
//                 ],
//                'nacos_config_yml' => [  // yaml_parse()方法找不到会报错
//                    'tenant' => env('nacos_namespace_id'),
//                    'data_id' => 'hypercmf-env-config.yaml',
//                    'group' => 'DEFAULT_GROUP',
//                    'type' => 'yaml',
//                ],
            ],
//            'client' => [
//                // nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
//                // 'uri' => '',
//                'host' => env('nacos_host', '127.0.0.1'),
//                'port' => env('nacos_port', '8848'),
//                'username' => env('nacos_username', 'nacos'),
//                'password' => env('nacos_password', 'nacos'),
//                'guzzle' => [
//                    'config' => null,
//                ],
//            ],
        ],
        //        'aliyun_acm' => [
        //            'driver' => Hyperf\ConfigAliyunAcm\AliyunAcmDriver::class,
        //            'interval' => 5,
        //            'endpoint' => env('ALIYUN_ACM_ENDPOINT', 'acm.aliyun.com'),
        //            'namespace' => env('ALIYUN_ACM_NAMESPACE', ''),
        //            'data_id' => env('ALIYUN_ACM_DATA_ID', ''),
        //            'group' => env('ALIYUN_ACM_GROUP', 'DEFAULT_GROUP'),
        //            'access_key' => env('ALIYUN_ACM_AK', ''),
        //            'secret_key' => env('ALIYUN_ACM_SK', ''),
        //            'ecs_ram_role' => env('ALIYUN_ACM_RAM_ROLE', ''),
        //        ],
        //        'etcd' => [
        //            'driver' => Hyperf\ConfigEtcd\EtcdDriver::class,
        //            'packer' => Hyperf\Utils\Packer\JsonPacker::class,
        //            'namespaces' => [
        //                '/application',
        //            ],
        //            'mapping' => [
        //                // etcd key => config key
        //                '/application/test' => 'test',
        //            ],
        //            'interval' => 5,
        //            'client' => [
        //                # Etcd Client
        //                'uri' => 'http://127.0.0.1:2379',
        //                'version' => 'v3beta',
        //                'options' => [
        //                    'timeout' => 10,
        //                ],
        //            ],
        //        ],
        //        'zookeeper' => [
        //            'driver' => Hyperf\ConfigZookeeper\ZookeeperDriver::class,
        //            'server' => env('ZOOKEEPER_SERVER', '127.0.0.1:2181'),
        //            'path' => env('ZOOKEEPER_CONFIG_PATH', '/conf'),
        //            'interval' => 5,
        //        ],
    ],
];
